﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Aioms.Dtos;
using Aioms.Models;
using Mapster;

namespace Aioms.Mapper
{
    public class TrbrcdListMapper : IRegister
    {
        public void Register(TypeAdapterConfig config)
        {
            Dictionary<int, string> level = new() { { 1, "轻微" }, { 2, "一般" }, { 3, "紧急" } };
            config.ForType<NrWorkOrder, TrbrcdListDto>()
                .Map(tl => tl.WoNumber, wo => wo.Number)
                .Map(tl => tl.NrNumber, wo => wo.NoticeRepair.RpNumber)
                .Map(tl => tl.Position, wo => wo.NoticeRepair.Position)
                .Map(tl => tl.Level, wo => level[wo.NoticeRepair.Level])
                .Map(tl => tl.IsHalt, wo => wo.NoticeRepair.IsHalt == 1 ? "是" : "否")
                .Map(tl => tl.TroubleTime, wo => wo.NoticeRepair.TroubleTime)
                .Map(tl => tl.WxBeginTime, wo => wo.SjBeginTime)
                .Map(tl => tl.WxEndTime, wo => wo.SjEndTime)
                .Map(tl => tl.Description, wo => wo.NoticeRepair.Description)
                .Map(tl => tl.SbRealname, wo => wo.NoticeRepair.SbepRealname)
                .Map(tl => tl.WxRealname, wo => wo.SjWxEpRealname);
        }
    }
}
